<html><head><title>FitLayout.js</title><link rel="stylesheet" type="text/css" href="../resources/style.css" media="screen"/></head><body><h1>FitLayout.js</h1><pre class="highlighted"><code><i>/**
 * @class Ext.layout.FitLayout
 * @extends Ext.layout.ContainerLayout
 * &lt;p&gt;This is a base class <b>for</b> layouts that contain a single item that automatically expands to fill the layout's
 * container.  This class is intended to be extended or created via the layout:<em>'fit'</em> {@link Ext.Container#layout}
 * config, and should generally not need to be created directly via the <b>new</b> keyword.&lt;/p&gt;
 * &lt;p&gt;FitLayout does not have any direct config options (other than inherited ones).  To fit a panel to a container
 * using FitLayout, simply set layout:<em>'fit'</em> on the container and add a single panel to it.  If the container has
 * multiple panels, only the first one will be displayed.  Example usage:&lt;/p&gt;
 * &lt;pre&gt;&lt;code&gt;
<b>var</b> p = <b>new</b> Ext.Panel({
    title: <em>'Fit Layout'</em>,
    layout:<em>'fit'</em>,
    items: {
        title: <em>'Inner Panel'</em>,
        html: <em>'&amp;lt;p&amp;gt;This is the inner panel content&amp;lt;/p&amp;gt;'</em>,
        border: false
    }
});
&lt;/code&gt;&lt;/pre&gt;
 */</i>
Ext.layout.FitLayout = Ext.extend(Ext.layout.ContainerLayout, {
    <i>// private</i>
    monitorResize:true,

    <i>// private</i>
    onLayout : <b>function</b>(ct, target){
        Ext.layout.FitLayout.superclass.onLayout.call(<b>this</b>, ct, target);
        <b>if</b>(!<b>this</b>.container.collapsed){
            <b>var</b> sz = (Ext.isIE6 &amp;&amp; Ext.isStrict &amp;&amp; target.dom == document.body) ? target.getViewSize() : target.getStyleSize();
            <b>this</b>.setItemSize(<b>this</b>.activeItem || ct.items.itemAt(0), sz);
        }
    },

    <i>// private</i>
    setItemSize : <b>function</b>(item, size){
        <b>if</b>(item &amp;&amp; size.height &gt; 0){ <i>// display none?</i>
            item.setSize(size);
        }
    }
});
Ext.Container.LAYOUTS[<em>'fit'</em>] = Ext.layout.FitLayout;</code></pre><hr><div style="font-size:10px;text-align:center;color:gray;">Ext - Copyright &copy; 2006-2007 Ext JS, LLC<br />All rights reserved.</div>
    </body></html>